package club.zhilin.guli.service.edu.controller.backend;

import club.zhilin.guli.common.base.result.CommonResult;
import org.springframework.web.bind.annotation.*;

import java.util.HashMap;
import java.util.Map;

/**
 * @author zhilin
 * @since 2022/1/13 16:25
 */
@RestController
@RequestMapping("/user")
public class LoginController {

    @PostMapping("/login")
    public CommonResult<Map<String, String>> login() {
        Map<String, String> map = new HashMap<>(1);
        map.put("token", "admin");
        return CommonResult.success(map);
    }

    @GetMapping("/info")
    public CommonResult<Map<String, String>> info(@RequestParam(value = "token") String token) {
        Map<String, String> result = new HashMap<>(2);
        result.put("name", "admin");
        result.put("avatar", "https://himg.bdimg.com/sys/portrait/item/public.1.ba5cd65e.C9LpYCQo75G2YAAJzH4Q2Q.jpg");
        return CommonResult.success(result);
    }

    @PostMapping("/logout")
    public CommonResult<String> logout() {
        return CommonResult.success();
    }
}